import { defineStore, acceptHMRUpdate } from "pinia";

export const useStore = defineStore({
    id: 'index',
    state: () => ({
        user: '',
        token: ''
    }),
    getters: {
        getUser: state => {
            return `getters ${state.user}`
        },
        getToken() {
            return window.sessionStorage.getItem('token')
        }
    },
    actions: {
        changeUser(user: any) {
            this.user = user
        },
        setToken(token: string) {
            this.token = token;
            window.sessionStorage.setItem('token', token);
        }
    }
})